from pyglet.gl import GL_LINES
import pyglet

from camera import world_to_pixels
import entity

class Wall(entity.StaticEdge):
    def __init__(self, mode, vertices):
        self.vertices = vertices

        super(Wall, self).__init__(mode, vertices=self.vertices, e_type="wall")

        vs = map(world_to_pixels, reduce(tuple.__add__, self.vertices, ()))
        self._vertex_list = pyglet.graphics.vertex_list(len(vs)/2,
                                                         ("v2f", vs),
                                                         ("c3B", (0, 0, 0)*(len(vs)/2)))
    def draw(self):
        self._vertex_list.draw(GL_LINES)

